package org.xxx.epms.gateway.config.service;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Collections;

@NoArgsConstructor
@Setter
@JsonIgnoreProperties(ignoreUnknown = true)
public class InspectorDetails implements UserDetails {

    private Integer insId;
    private String insPassword;

    public InspectorDetails(Integer insId, String insPassword) {
        this.insId = insId;
        this.insPassword = insPassword;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return Collections.emptyList();
    }

    @Override
    public String getPassword() {return this.insPassword;
    }

    @Override
    public String getUsername() {
        return this.insId.toString();
    }

    @Override
    public boolean isAccountNonExpired() {
        return false;
    }

    @Override
    public boolean isAccountNonLocked() {
        return false;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return false;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
